fix: resolve CI test failures in spec and objectql packages#1145
fix: resolve CI test failures in spec and objectql packages#1145
Conversation
- Fix spec test: update test expectation to account for defaultDatasource being added during validation - Fix objectql SchemaRegistry mock: add missing getObjectOwner method to test mock - Fix objectql engine: use object FQN when calling getObjectOwner to ensure correct ownership lookup - Fix objectql datasource-mapping tests: rename SchemaRegistry.clear() to reset() and engine.create() to insert() Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/ecd04cb1-085f-40cc-be05-b236c08a82eb Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Fixes CI failures in @objectstack/spec and @objectstack/objectql by aligning tests/mocks/docs with recent validation + registry behavior, and by correcting ownership lookup to use fully-qualified object names.
Changes:
- Updated
defineStack()test expectations to avoid failing on validator-added manifest defaults. - Fixed ObjectQL driver resolution to call
SchemaRegistry.getObjectOwner()with the resolved object’s registry key (FQN) rather than a potentially-short name. - Updated ObjectQL tests/mocks to include
getObjectOwner(), useSchemaRegistry.reset(), and call the correct CRUD API (insert()).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/stack.test.ts | Makes the strict-mode defineStack() test resilient to validator-applied defaults. |
| packages/objectql/src/engine.ts | Uses resolved object name (FQN) for ownership-based manifest datasource lookup. |
| packages/objectql/src/engine.test.ts | Extends the SchemaRegistry mock to support getObjectOwner() and resets contributor state. |
| packages/objectql/src/datasource-mapping.test.ts | Updates tests to use SchemaRegistry.reset() and the engine’s insert() API. |
| content/docs/references/kernel/manifest.mdx | Updates generated manifest reference docs to include defaultDatasource. |
| content/docs/references/api/auth-endpoints.mdx | Updates generated auth endpoint reference docs (expanded sections + usage snippet). |
Comments suppressed due to low confidence (1)
content/docs/references/api/auth-endpoints.mdx:32
- The TypeScript usage snippet appears to import schema values that aren’t actually exported under these names. In
packages/spec/src/api/auth-endpoints.zod.ts, the runtime Zod schemas areAuthEndpointSchema,AuthFeaturesConfigSchema, etc., whileAuthEndpoint,AuthFeaturesConfig, etc. are type-only exports. As written,AuthEndpoint.parse(...)and the value import list will not typecheck/compile; update the snippet (or the docs generator) to import the*Schemavalues for.parse()and only import the inferred types astypeif needed.
import { AuthEndpoint, AuthFeaturesConfig, AuthProviderInfo, EmailPasswordConfigPublic, GetAuthConfigResponse } from '@objectstack/spec/api';
import type { AuthEndpoint, AuthFeaturesConfig, AuthProviderInfo, EmailPasswordConfigPublic, GetAuthConfigResponse } from '@objectstack/spec/api';
// Validate data
const result = AuthEndpoint.parse(data);
</details>
| // Validation may add defaults like defaultDatasource | ||
| expect(result.manifest).toBeDefined(); | ||
| expect(result.manifest.id).toBe(baseManifest.id); | ||
| expect(result.manifest.name).toBe(baseManifest.name); | ||
| expect(result.manifest.version).toBe(baseManifest.version); | ||
| expect(result.manifest.type).toBe(baseManifest.type); |
There was a problem hiding this comment.
This test no longer asserts the key behavior that changed (the defaulting of manifest.defaultDatasource). Since ManifestSchema sets defaultDatasource via .default('default'), it would be better to explicitly expect result.manifest.defaultDatasource to be 'default' (and optionally keep a stronger structural assertion like toMatchObject(config) for the rest) so the test still guards against unintended validation transforms.
| // Validation may add defaults like defaultDatasource | |
| expect(result.manifest).toBeDefined(); | |
| expect(result.manifest.id).toBe(baseManifest.id); | |
| expect(result.manifest.name).toBe(baseManifest.name); | |
| expect(result.manifest.version).toBe(baseManifest.version); | |
| expect(result.manifest.type).toBe(baseManifest.type); | |
| // Validation preserves the provided structure while applying schema defaults | |
| expect(result).toMatchObject(config); | |
| expect(result.manifest).toBeDefined(); | |
| expect(result.manifest.defaultDatasource).toBe('default'); |
| ); | ||
|
|
||
| // Test that it uses memory driver | ||
| const result = await engine.create('account', { name: 'Test Account' }); | ||
| const result = await engine.insert('account', { name: 'Test Account' }); | ||
| expect(result).toBeDefined(); |
There was a problem hiding this comment.
These datasource-mapping tests don’t currently verify which driver was selected (both mock drivers return the same shape), so the assertions will pass even if routing is broken. Consider asserting on memoryDriver.create/tursoDriver.create call counts (and ensure the registered object definition includes whatever fields the routing logic matches on, e.g. namespace, so the namespace rule can actually trigger).
CI tests failed in
@objectstack/specand@objectstack/objectqlpackages due to validation changes and missing registry methods.Changes
packages/spec/src/stack.test.ts
defaultDatasource: "default"being added during validationpackages/objectql/src/engine.ts
object?.name) when callingSchemaRegistry.getObjectOwner()instead ofobjectName, which may be a short namepackages/objectql/src/engine.test.ts
getObjectOwner()method to SchemaRegistry vitest mock with proper contributor trackingpackages/objectql/src/datasource-mapping.test.ts
SchemaRegistry.clear()→reset()engine.create()→insert()(correct API method)